package router

import (
	"SYY/middleware"

	"SYY/handler"

	"github.com/henrylee2cn/faygo"
)

// Route register router in a tree style.
func Route(frame *faygo.Framework) {
	frame.Route(
		//Start part of SYY
		frame.NewNamedGET("index", "/", handler.Homepage),
		frame.NewNamedGET("index", "/index", handler.Index).Use(middleware.CheckLogin),
		frame.NewNamedGET("HOME", "/home", handler.Home),
		frame.NewNamedPOST("login", "/login", &handler.Admin{}),

		frame.NewNamedGET("Release", "/Release", &handler.Release).Use(middleware.CheckLogin),
		frame.NewNamedGET("编辑规章制度", "/Release2", &handler.Release2).Use(middleware.CheckLogin),

		frame.NewNamedPOST("news", "/news", &handler.News{}),

		frame.NewNamedGET("Release", "/Stafflist", &handler.StaffList).Use(middleware.CheckLogin),
		frame.NewNamedPOST("Staff", "/Staff", &handler.Staff{}),

		frame.NewNamedGET("Email", "/emaillist", handler.CheckRequest).Use(middleware.CheckLogin),
		frame.NewNamedPOST("email", "/email", &handler.Email{}),

		frame.NewNamedGET("reply", "/replylist", handler.Replylist).Use(middleware.CheckLogin),
		frame.NewNamedGET("filemanager", "/filemanager", handler.Filemanager).Use(middleware.CheckLogin),
		frame.NewNamedPOST("DeleteFile", "/DeleteFile", handler.DeleteFile).Use(middleware.CheckLogin),
		frame.NewNamedPOST("uploadfile", "/uploadfile", handler.Uploadfile).Use(middleware.CheckLogin),
		frame.NewNamedGET("uploadfile", "/rencai", handler.Rencai).Use(middleware.CheckLogin),
		frame.NewNamedPOST("email", "/rc", &handler.Rc{}),


		//End part of SYY

		//Start part of DSC

		frame.NewNamedGET("index", "/home2", handler.Home2),
		frame.NewNamedPOST("index", "/stafflogin", &handler.Stafflogin{}),
		frame.NewNamedGET("index", "/index2", handler.Index2).Use(middleware.CheckLogin2),

		frame.NewNamedGET("index", "/request", handler.Request).Use(middleware.CheckLogin2),
		frame.NewNamedGET("index", "/Getnews", handler.Getnews).Use(middleware.CheckLogin2),
		frame.NewNamedGET("index", "/newlist", handler.Newlist).Use(middleware.CheckLogin2),
		frame.NewNamedGET("index", "/newlist2", handler.Newlist2).Use(middleware.CheckLogin2),

		frame.NewNamedGET("StaffList2", "/stafflist2", &handler.StaffList2).Use(middleware.CheckLogin2),

		frame.NewNamedPOST("reply", "/reply", &handler.Reply{}),
		frame.NewNamedGET("Myreply", "/Myreply", &handler.Myreply).Use(middleware.CheckLogin2),
		frame.NewNamedGET("filelist", "/filelist", &handler.Filelist).Use(middleware.CheckLogin2),
		frame.NewNamedGET("rencai2", "/rencai2", handler.Rencai2).Use(middleware.CheckLogin2),

		//End part of DSC
	)
}
